#pragma once
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <string>
#include <list>
#include <vector>
#include "Config.h"
#include "singleChannelHistogram.h"

using namespace std;
using namespace cv;

#define  WINDOWWIDTH  40
#define  INITFILTERNUM	30
#define  FILTERWIDTH  9
#define  R  30
#define  LOSSOBJECT 10
#define  THREWHITE 10

#define  LIST_LEN 100

class HOO
{
public:
	HOO(void);
	HOO(const Config& conf);
	//void addMassPoint(IplImage *Img);
	void addMutipleTrajectoryPoint(IplImage* image,IplImage *segImage);
	Point2i Filter();
	float filterWight(int k);
	Point2i pointListAt(int n);
	void pointListPlaceAt(Point2i pot,int k);

	Point2i initialize(IplImage *imge);
	//Point2i HOO::searchPoint(Point2i p0,IplImage *img);
	void trackingLine(IplImage* imge);
	void setImageSize(int w,int h);

	void multiInitialize();
	void multipleSearch(IplImage* image);
	bool isTheSameState(Point2i* _state,int StateCount,int** numOfTracjectory);
	bool detachTrajectory(IplImage* image,Point2i* _state,int numOfTarjectory);
	bool searchPoint(Point2i& lastState,IplImage *img,int Radius);
	bool getMassLastState(Point2i* state,int stateCount);
	
	int DistinguishObjectUsingHist(IplImage* image,IplImage* segImage,int* numOfTracjectory);
	~HOO(void);

public:
	bool _initialized;

	int _filterWidth;
	int _windowWidth;

	int _boxWidthMax,_boxWidthMin;
	int _boxHeightMax,_boxHeightMin;

	int* _lossObject;
	Point2i* _lastState;

	list<Point2i>* pointTrajectList;
	const Config config;
	singleChannelHistogram* sinHist[];
};

